<h1>Simpanan Pokok</h1>

<a href="pokok_tambah.php" class="btn btn-primary">+ Tambah Simpanan Pokok</a>

<table class="table">
    <thead>
        <tr>
            <th>No</th>
            <th>No Anggota</th>
            <th>Nama</th>
            <th>Jumlah</th>
            <th>Tanggal</th>
        </tr>
    </thead>
    <tbody>
        <?php if ($result && $result->num_rows > 0): ?>
            <?php $no = 1; while ($row = $result->fetch_assoc()): ?>
                <tr>
                    <td><?= $no++; ?></td>
                    <td><?= htmlspecialchars($row['no_anggota']); ?></td>
                    <td><?= htmlspecialchars($row['nama']); ?></td>
                    <td><?= number_format($row['jumlah'], 0, ',', '.'); ?></td>
                    <td><?= date('d-m-Y', strtotime($row['tanggal'])); ?></td>
                </tr>
            <?php endwhile; ?>
        <?php else: ?>
            <tr>
                <td colspan="5">Belum ada simpanan pokok</td>
            </tr>
        <?php endif; ?>
    </tbody>
</table>
